package com.deyuanyun.pic.pipe.domain.custom;

import java.text.SimpleDateFormat;

import com.deyuanyun.pic.common.util.ConvertUtil;
import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.pipe.domain.PicPipeIdentification;
import com.deyuanyun.pic.pipe.domain.exceldomain.GroundMarkVO;

/**
 * Created by xu on 2016/1/21.
 */
public class CustomPicPipeIdentification extends PicPipeIdentification {
    private String lineName;
    private String segmentName;

    public String getLineName() {
        return lineName;
    }

    public void setLineName(String lineName) {
        this.lineName = lineName;
    }

    public String getSegmentName() {
        return segmentName;
    }

    public void setSegmentName(String segmentName) {
        this.segmentName = segmentName;
    }

    public GroundMarkVO toMarkVO()throws Exception{
        /*PicPipeIdentification pipeIdentification=new PicPipeIdentification();
        ConvertUtil.coverWithSpring(this,pipeIdentification);*/

        GroundMarkVO groundMarkVO=new GroundMarkVO();
        ConvertUtil.coverWithSpring(this,groundMarkVO);
        if (this.getRecordtime()!=null){
            SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd");
            String rtime=f.format(this.getRecordtime());
            groundMarkVO.setRecordtime(rtime);
        }
        groundMarkVO.setPipeLineId(this.getLineName());
        groundMarkVO.setPipeSegmentId(this.getSegmentName());
        try {
            groundMarkVO.setLaocationX(ObjectUtil.nvl(this.getMileage(),"") );
        } catch (Exception e) {
            e.printStackTrace();
        }

        return groundMarkVO;
    }
}
